#include "AbstractObject.h"

AbstractObject::AbstractObject(void) : mpEntity(0), mpNode(0)
{
}

AbstractObject::~AbstractObject(void)
{
}

void AbstractObject::setMesh(const std::string& meshName, Ogre::SceneManager* pSceneMgr)
{
	mpEntity = pSceneMgr->createEntity(meshName);
    mpEntity->setCastShadows(true);
    mpNode = pSceneMgr->getRootSceneNode()->createChildSceneNode();
	mpNode->attachObject(mpEntity);
}

void AbstractObject::setMaterial(const std::string& materialName)
{
	mpEntity->setMaterialName(materialName);
}

void AbstractObject::setPosition(Ogre::Vector3 pos)
{
	mpNode->setPosition(pos);
}

void AbstractObject::setScale(Ogre::Vector3 scale)
{
	mpNode->setScale(scale);
}

Ogre::Vector3 AbstractObject::getPosition(void)
{
	return mpNode->getPosition();
}

void AbstractObject::setRotation(Ogre::Radian angle)
{
	mpNode->rotate(Ogre::Vector3::UNIT_Y,angle);
}

void AbstractObject::setShadowCaster(bool castShadows)
{
	mpEntity->setCastShadows(castShadows);
}